<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="cn.dai.service.UserService" %>
<%@ page import="cn.dai.service.UserServiceImpl" %>
<%@ page import="cn.dai.pojo.User" %>
<%@ page import="cn.dai.service.model.Page" %>
<%@ page import="cn.dai.dao.UserDaoImpl" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/11
  Time: 12:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>测试页面</title>
</head>
<body>

<%
    UserService userService = new UserServiceImpl(new UserDaoImpl());

    String p = request.getParameter("page");

    if (p == null) p = "1";

    Integer pageIndex = Integer.valueOf(p);

    Page<User> userPage = userService.getUserPage(pageIndex);
%>


<table border="1" width="100%">

    <caption> <h1>用户列表</h1> </caption>

    <tr>
        <td>索引编号</td>
        <td>用户编号</td>
        <td>用户名称</td>
        <td>用户密码</td>
        <td>用户邮箱</td>
        <td>用户电话</td>
        <td>用户状态</td>
    </tr>

    <c:forEach items="<%=userPage.getCurrentList()%>" var="user" varStatus="statusObject">

        <tr>
            <td> ${statusObject.count} </td>
            <td> ${user.u_id}</td>
            <td> ${user.u_name}</td>
            <td> ${user.u_password}</td>
            <td> ${user.u_email}</td>
            <td> ${user.u_phone}</td>
            <td> ${user.u_status}</td>
        </tr>

    </c:forEach>
</table>
</body>
</html>
